using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Sys_Log - 管理员日志 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class ISysLog<T> :ModelBase<SysLog> where T : SysLog, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.LogId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return LogId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.LogId=dy.LogId;
           this.UserId=dy.UserId;
           this.LogTime=dy.LogTime;
           this.ConText=dy.ConText;
           this.TypeId=dy.TypeId;
        } 

        #region 定义属性

     
         /// <summary>
        /// 日志ID
        /// </summary>
        private String _LogId = "";
      
        /// <summary>
        /// 日志ID
        /// </summary>
        public String LogId
        {
            get 
            {
              return   (this._LogId); 
            }

            set 
            {
                    _LogId= value;  
            }
        }
       
     
         /// <summary>
        /// 管理员
        /// </summary>
        private String _UserId = "";
      
        /// <summary>
        /// 管理员
        /// </summary>
        public String UserId
        {
            get 
            {
              return   (this._UserId); 
            }

            set 
            {
                    _UserId= value;  
            }
        }
       
     
         /// <summary>
        /// 日志时间
        /// </summary>
        private DateTime _LogTime =DateTime.MinValue;
      
        /// <summary>
        /// 日志时间
        /// </summary>
        public DateTime LogTime
        {
            get 
            {
              return   (this._LogTime); 
            }

            set 
            {
                    _LogTime= value;  
            }
        }
       
     
         /// <summary>
        /// 内容
        /// </summary>
        private String _ConText = "";
      
        /// <summary>
        /// 内容
        /// </summary>
        public String ConText
        {
            get 
            {
              return   (this._ConText); 
            }

            set 
            {
                    _ConText= value;  
            }
        }
       
     
         /// <summary>
        /// 操作类别
        /// </summary>
        private int _TypeId =int.MinValue;
      
        /// <summary>
        /// 操作类别
        /// </summary>
        public int TypeId
        {
            get 
            {
              return   (this._TypeId); 
            }

            set 
            {
                    _TypeId= value;  
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(SysLog info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["LogId"]!= DBNull.Value)
                  {
                  info.LogId=row["LogId"].ToString();
                 }
                 
                  
                  if(row["UserId"]!= DBNull.Value)
                  {
                  info.UserId=row["UserId"].ToString();
                 }
                 
                  
                  if(row["LogTime"]!= DBNull.Value)
                  {
                  info.LogTime=Convert.ToDateTime(row["LogTime"]);
                 }
                 
                  
                  if(row["ConText"]!= DBNull.Value)
                  {
                  info.ConText=row["ConText"].ToString();
                 }
                 
                  
                  if(row["TypeId"]!= DBNull.Value)
                  {
                  info.TypeId=Convert.ToInt32(row["TypeId"]);
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, SysLog info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@LogId", DbType.String,ParameterTool.GetObj( info._LogId )); 
            
             
                cn.AddInParameter(comm, "@UserId", DbType.String,ParameterTool.GetObj( info._UserId )); 
            
             
                cn.AddInParameter(comm, "@LogTime", DbType.DateTime,ParameterTool.GetObj( info._LogTime )); 
            
             
                cn.AddInParameter(comm, "@ConText", DbType.String,ParameterTool.GetObj( info._ConText )); 
            
             
                cn.AddInParameter(comm, "@TypeId", DbType.Int32,ParameterTool.GetObj( info._TypeId )); 
            
        } 

    } 
} 